import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
		userName:'',
		userId:'',
		userCoverPath:'',
		token:'',
		baseHttp:'https://zzxfkme.icu:5001/',
		// localhost:'http://localhost:8080/#/', 
		localhost:'http://zzxfkme.icu:5002/#/',
		isSetL2Pwd:null,
		toUserId:''
		},
  mutations: {
		updataUserData(state,userData){
			state.token = 'bearer '+ userData.token;
			state.userId = userData.userId;
			state.toUserId = userData.userId;
			state.userName = userData.userName
			if(userData.userCoverPath != ''){
				state.userCoverPath = state.baseHttp + userData.userCoverPath
			}
			state.isSetL2Pwd = userData.isSetL2Pwd
		},
		updataCoverPath(state,coverPath){
			state.userCoverPath = ''+ state.baseHttp + coverPath
		},
		updataL2pwd(state){
			state.isSetL2Pwd = true;
		},
		updataUserId(state,userId){
			state.toUserId = userId
		}
	},
  actions: {},
  modules: {},
});
